<template>
  <div class="task-preview-container">

    <div class="task-details">
      <div class="task-info">
        <span class="info-label">编程语言:</span>
        <span class="info-value">{{ task.langName}}</span>
      </div>
      <div class="task-info">
        <span class="info-label">模块名称:</span>
        <span class="info-value">{{ task.module }}</span>
      </div>
      <div class="task-info">
        <span class="info-label">难易程度:</span>
        <span class="info-value">{{ task.leave }}</span>
      </div>
    </div>
    <div class="task-content">{{ task.title }}
      <pre>
          <code></code>
      </pre>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    task:{
      type: Object,
      required: true
    },
  },
	name: 'TaskPreviewView',
}
</script>

<style scoped>
.task-preview-container {
  margin: 0 auto;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.task-header {
  text-align: center;
  margin-bottom: 20px;
}

.task-title {
  font-size: 28px;
  font-weight: bold;
  color: #333;
}

.task-details {
  display: flex;
  justify-content: space-between;
  line-height: 40px;
  background-color: #f3f3f3;
  margin-bottom: 10px;
  border-radius: 8px;
}

.task-info {
  flex: 1;
  text-align: center;
}

.info-label {
  font-weight: bold;
  color: #555;
  margin-right: 10px;
}

.info-value {
  color: #777;
}

.task-content {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  height: 500px;
  overflow: auto;
}

.task-content pre:has(>code) {
  background: #F0F2F5;
  color: #333;
  padding: 10px;
  border-radius: 5px;
  overflow-x: auto;
}

.task-content code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
}
</style>